home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
ASSEMBLE
/
H055.ZIP
/
DEMO
/
PLOTXY.ALC
< prev
next >
Wrap
Text File
|
1987-08-20
|
4KB
|
121 lines
TITLE 'PLOTXY.ALC - PLOT Y=SIN(X) USING 320 X 200 COLOR SCREEN'
*
* PGM-ID. GRAPH.ALC
* AUTHOR. DON HIGGINS
* DATE. 08/20/87
* REMARKS. PLOT SIN WAVE ON 320X200 SCREEN USING 80X87 SCIENTIFIC
* SUBROUTINE PACKAGE SIN FUNCTION.
*
PLOTXY CSECT
LR R12,R15
USING PLOTXY,R12
LA R2,=C' PLOTXY.ALC GRAPH OF SIN WAVE$'
SVC WTO
LA R2,=C' THIS PGM REQUIRES COLOR 320X200 MONITOR AND 80X87$'
SVC WTO
LA R2,=C' HIT ANY KEY TO START$'
SVC WTO
SVC READCON
ICM R0,B'0011',=AL1(VIOSETM,VIOM320)
SVC VIDEOIO SET GRAPHIC 320 X 200 MODE
LD FR0,=D'0'
STD FR0,XMIN XMIN=0.
STD FR0,X X=XMIN
L R15,=V(PI)
BALR R14,R15
MD FR0,=D'2'
STD FR0,XMAX XMAX=2*PI
SD FR0,XMIN
DD FR0,XPIXILS
STD FR0,XINC XINC=(XMAX-XMIN)/XPIXILS
LD FR2,=D'1'
DDR FR2,FR0
STD FR2,XSCALE XSCALE=XPIXILS/(XMAX-XMIN)
LD FR0,=D'-1'
STD FR0,YMIN YMIN=-1 FOR SIN
LD FR0,=D'1'
STD FR0,YMAX YMAX=1 FOR SIN
SD FR0,YMIN
LD FR2,YPIXILS
DDR FR2,FR0
STD FR2,YSCALE YSCALE=YPIXILS/(YMAX-YMIN)
LOOP EQU * PLOT Y=F(X) FOR X=XMIN,XMAX,XINC
LD FR0,X
LDR FR2,FR0 SAVE X IN FR2 FOR DEBUG
L R15,=V(SIN)
BALR R14,R15 FR0=SIN(X)
LDR FR4,FR0 SAVE SIN(X) IN FR4 FOR DEBUG
STD FR0,Y
BAL R14,PLOT
LD FR0,X
AD FR0,XINC
STD FR0,X
CD FR0,XMAX
BL LOOP
EOJ EQU *
SVC READCON HOLD SCREEN UNTIL NEXT KEY
ICM R0,B'0011',=AL1(VIOSETM,VIOM2480)
SVC VIDEOIO SET 24X80 CHARACTER MODE
SVC EXIT EXIT TO MS-DOS
PLOT EQU * PLOT (X,Y) SCALED TO 320X200 SCREEN
ST R14,SAVE14
LD FR0,Y
SD FR0,YMIN
MD FR0,YSCALE
L R15,=V(INT)
BALR R14,R15 R0=INT((Y-YMIN)*YSCALE)
ST R0,IY
LR R4,R0 SAVE IY IN R4 FOR DEBUG
LD FR0,X
SD FR0,XMIN
MD FR0,XSCALE
L R15,=V(INT)
BALR R14,R15 R0=INT((X-XMIN)*XSCALE)
ST R0,IX
LR R2,R0 SAVE IX IN R2 FOR DEBUG
ICM R0,B'0011',=AL1(VIOPSET,VIOPCV)
L R14,IX
L R15,IYPIXILS
S R15,IY
SVC VIDEOIO SET PIXIL AT (IX,IY)
L R14,SAVE14
BR R14
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R12 EQU 12
R14 EQU 14
R15 EQU 15
FR0 EQU 0 FLOATING POINT REG 0
FR2 EQU 2
FR4 EQU 4
FR6 EQU 6
VIOSETM EQU 0 AH VALUE FOR VIDEOIO SET MODE (SEE A-48)
VIOM320 EQU 4 AL VALUE FOR 320 X 200 MODE
VIOM2480 EQU 2 AL VALUE FOR 24 X 80 BW CHARACTER MODE
VIOPSET EQU 12 AH VALUE FOR VIDEOIO SET BIT (SEE A-49)
VIOPCV EQU 1 AL VALUE FOR COLOR VALUE
VIDEOIO EQU X'80'+X'10' 8086 VIDEO BIOS INTERRUPT SVC
EXIT EQU 0 EXIT TO MS-DOS
WTO EQU 209 WRITE TO OPERATOR
READCON EQU 207 READ KEYBOARD CHARACTER INTO R0
XPIXILS DC D'318' 320-2 TO AVOID MISSING PIXILS AT EDGE
YPIXILS DC D'198' 200-2 TO AVOID MISSING PIXILS AT EDGE
IYPIXILS DC F'199' REVERSE IY TO MOVE ORIGIN FROM UPPER LEFT TO LOWER
X DC D'0'
XMAX DC D'0'
XMIN DC D'0'
XINC DC D'0' CALC (XMAX-XMIN)/XPIXILS
XSCALE DC D'0' CALC XPIXILS/(XMAX-XMIN)
Y DC D'0'
YMAX DC D'0'
YMIN DC D'0'
YSCALE DC D'0' CALC YPIXILS/(YMAX-YMIN)
IX DC F'0'
IY DC F'0'
SAVE14 DC A(0)
END PLOTXY